package com.qf.device.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.device.entity.DeviceModel;
import com.qf.device.mapper.DeviceModelMapper;
import com.qf.device.service.DeviceModelService;
import com.qf.dto.PageDto;
import com.qf.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 租户物模型属性表 服务实现类
 * </p>
 *
 * @author zhu
 * @since 2023-10-26
 */
@Service
public class DeviceModelServiceImpl extends ServiceImpl<DeviceModelMapper, DeviceModel> implements DeviceModelService {

    @Autowired
    private DeviceModelMapper deviceModelMapper;

    @Override
    public PageResult<DeviceModel> pageInfo(PageDto<DeviceModel> pageDto) {
        String propertyName = null;
        int modelType = 0;
        String deviceKey = null;
        //条件判断
        if (!StringUtils.isEmpty(pageDto.getWhere().getPropertyName())){
            propertyName = pageDto.getWhere().getPropertyName();
        }
        if (!StringUtils.isEmpty(pageDto.getWhere().getModelType())){
            modelType = pageDto.getWhere().getModelType();
        }
        if (!StringUtils.isEmpty(pageDto.getWhere().getDeviceKey())){
            deviceKey = pageDto.getWhere().getDeviceKey();
        }
        //获取所有的DeviceModel列表
        //deviceModelMapper.findAll(pageDto,propertyName, modelType,deviceKey);
        //查询总条数

        //计算总页数

        //封装数据
        return null;
    }
}
